<template>
			<!-- <div class="nav_header"  :style="{'background':$store.state.theme.bgColor}"> -->
				<div class="nav_header"  style="background:#fff">
					<p class="nav_header_company">
						<img class="nav_header_company_img" src="http://d.hiphotos.baidu.com/image/pic/item/9213b07eca8065384f668af49ddda144ac34824c.jpg">
						{{company.companyName}}
					</p>
					<div class="nav_header_message">
						<div class="select_company" :style="{'background':$store.state.theme.bgColor}">
							选择公司<i class="iconfont icon-jiantoukongup select_company_icon"></i>
							<ul class="select_company_items">
								<li class="select_company_item" v-for="val in companyList">{{val.companyname}}</li>
								<!-- <li class="select_company_item">深圳中砼物联网公司下属公司</li> -->
							</ul>
						</div>
						<div class="user_message">
							<el-badge :value="12" class="item">
								<el-button size="mini">消息</el-button>
							</el-badge>
							<img class="nav_header_company_img" src="http://d.hiphotos.baidu.com/image/pic/item/9213b07eca8065384f668af49ddda144ac34824c.jpg">
						<el-dropdown>
							<span class="company_name">{{userName}}<i class="el-icon-arrow-down el-icon--right"></i></span>
							<el-dropdown-menu slot="dropdown">
						    <el-dropdown-item>个人中心</el-dropdown-item>
								<el-dropdown-item>设置</el-dropdown-item>
						  </el-dropdown-menu>
						</el-dropdown>
							<el-color-picker class="select_color" @change="colorChange"  size="mini" v-model="this.$store.state.theme.bgColor"></el-color-picker>
						</div>
					</div>
			</div>
</template>

<script>
import {mapGetters,mapActions} from 'vuex'
import {get_Userinfo,get_Token} from '@/utils/auth.js'
export default {
  data() {
		console.log(this.$store.state.routerTabs);
    return {
        options: [{
				value: '公司1',
				label: '公司1'
			}, {
				value: '公司2',
				label: '公司2'
			}],
			test:'1234',
			color : "#3d3d3d",
			companyList:'',
			// company:this.$store.state.company
		}
	},
	methods:{
		colorChange(color){
			this.$store.state.theme.bgColor = color;
		},
		getCompany(){
			this.$post('/company/getCompanyList',{pageNum:0,pageSize:100},(data)=> {
				 this.companyList = data.rows;
			},(err)=>{})
		}
	},
	computed:mapGetters([
		'company',
		'userName'
	]),
	created(){
	},
	mounted(){
		console.log(get_Userinfo())
		// this.companyName = this.$store.state.userInfo.company.companyName;
		// this.userName = this.$store.state.userInfo.userName;
		// let userInfo = JSON.parse(localStorage.getItem("userInfo"));
		// console.log(userInfo);
		// this.userName = userInfo.userName;
		// this.companyName = userInfo.company.companyName;
		// this.getCompany();
	}
}
</script>

<style scoped lang="scss">
	@import "./nav-header.scss";
</style>
